<template>
  <div class="result">
    <div style="padding-top:10vh;">
      <a-icon
        :class="[isbind ? 'success' : 'error' ,'icon']"
        :type="isbind ? 'check-circle' : 'close-circle'"
      />
    </div>
    <div class="title" v-if="isbind">绑定成功</div>
    <div class="title" v-if="!isbind">绑定失败</div>

    <div v-if="!isbind">失败原因：{{Failurereason}}</div>
    <div class="content1" v-if="isbind">
      <a-button type="primary" @click="gobankset">确定</a-button>
    </div>
    <div class="content1" v-if="!isbind">
      <a-button type="primary" @click="goback">重新绑定</a-button>
    </div>
  </div>
</template>

<script>
import AIcon from "ant-design-vue/es/icon";
export default {
  name: "Result",
  components: { AIcon },
  data() {
    return {
      isbind: false,
      Failurereason: "未知错误"
    };
  },
  mounted() {
    if (this.$route.query.isok == "true") {
      this.isbind = true;
    } else {
      this.isbind = false;
    }
  },
  methods: {
    gobankset() {
      //判断是否有值，有值则返回至付款页面
      var bankUrl = localStorage.getItem("bankUrl");
      if(bankUrl){
        location.href = bankUrl;
        return;
      }
      let addbankType = sessionStorage.getItem("addbankType");
      if (addbankType == "1") {
        this.$router.push("/per/accountmanage/perbankset");
      } else if (addbankType == "2") {
        this.$router.push({ path: "/perCashOut1" });
      } else if (addbankType == "3") {
        this.$router.push({ path: "/perRecharge" });
      } else {
      }
    },
    goback() {
      //判断是否有值，有值则携带参数返回至银行卡新增界面
      var bankUrl = localStorage.getItem("bankUrl");
      if(bankUrl){
        this.$router.push({path: "/per/bankadd/bankno",query: { bankUrl: bankUrl}});
        return;
      }
      let addbankType = sessionStorage.getItem("addbankType");
      if (addbankType == "1") {
        this.$router.push("/per/accountmanage/perbankset");
      } else if (addbankType == "2") {
        this.$router.push({ path: "/perCashOut" });
      } else if (addbankType == "3") {
        this.$router.push({ path: "/perRecharge" });
      } else {
      }
    }
  }
};
</script>

<style scoped>
/* @import " ../../../../static/css/color.css"; */
.result {
  text-align: center;
  width: 72%;
  margin: 0 auto;
}
.icon {
  font-size: 72px;
  line-height: 72px;
  margin-bottom: 24px;
}
.success {
  color: green;
}
.error {
  color: red;
}
.title {
  font-size: 24px;
  color: rgba(0, 0, 0, 0.75);
  font-weight: 500;
  line-height: 32px;
  margin-bottom: 32px;
}
.desc {
  font-size: 14px;
  line-height: 22px;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 24px;
}
.content {
  background: #fafafa;
  padding: 24px 40px;
  border-radius: 2px;
  text-align: center;
}
.content1 {
  background: #fafafa;
  padding: 24px 40px;
  width: 50%;
  margin: 24px auto;
  border-radius: 2px;
  text-align: center;
}
.action {
  margin-top: 32px;
}
</style>
